﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <joined-subclass name="EnetaMvc.Core.Domain.Forums.ForumPost,EnetaMvc.Core" extends="EnetaMvc.Core.Domain.Content.ContentItem,EnetaMvc.Core" table="forum_post">

    <key column="content_item_id" />

    <property name="Modified" column="modified" type="DateTime" not-null="false" />
    <property name="ModificationComment" column="modification_comment" type="string" />
    <property name="Views" column="views" type="int" />

    <many-to-one name="ModifiedBy" column="modified_by_id" class="EnetaMvc.Core.Domain.Common.User,EnetaMvc.Core" />
    <many-to-one name="Forum" column="forum_id" class="EnetaMvc.Core.Domain.Forums.Forum,EnetaMvc.Core" />
    <many-to-one name="Parent" column="parent_id" class="EnetaMvc.Core.Domain.Forums.ForumPost,EnetaMvc.Core" />

    <bag name="Replies" table="forum_post" inverse="true" cascade="all">
      <key column="parent_id" />
      <one-to-many class="EnetaMvc.Core.Domain.Forums.ForumPost,EnetaMvc.Core" />
    </bag>
  </joined-subclass>
</hibernate-mapping>